package model

import (
	"gorm.io/gorm"
	"time"
)

type Houses struct {
	Id        uint           `gorm:"column:id;type:bigint UNSIGNED;comment:id;primaryKey;not null;" json:"id"`                          // id
	UserId    uint           `gorm:"column:user_id;type:bigint UNSIGNED;comment:用户id;not null;default:0;" json:"user_id"`               // 用户id
	Title     string         `gorm:"column:title;type:varchar(30);comment:标题;not null;" json:"title"`                                   // 标题
	Price     uint           `gorm:"column:price;type:int UNSIGNED;comment:价格;not null;default:0;" json:"price"`                        // 价格
	Area      uint           `gorm:"column:area;type:int UNSIGNED;comment:面积;not null;default:0;" json:"area"`                          // 面积
	City      string         `gorm:"column:city;type:varchar(15);comment:城市;not null;" json:"city"`                                     // 城市
	Address   string         `gorm:"column:address;type:varchar(50);comment:地址;not null;" json:"address"`                               // 地址
	Community string         `gorm:"column:community;type:varchar(10);comment:小区名;not null;" json:"community"`                          // 小区名
	FileUrl   string         `gorm:"column:file_url;type:varchar(300);comment:封面图;not null;" json:"file_url"`                           // 封面图
	VideoUrl  string         `gorm:"column:video_url;type:varchar(300);comment:视频;not null;" json:"video_url"`                          // 视频
	Status    uint           `gorm:"column:status;type:bigint UNSIGNED;comment:状态: 1:在售 2:已售 3:已下架 ;not null;default:1;" json:"status"` // 状态: 1:在售 2:已售 3:已下架
	CreatedAt time.Time      `gorm:"column:created_at;type:datetime(3);not null;" json:"created_at"`
	UpdatedAt time.Time      `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3);default:NULL;" json:"deleted_at"`
}

func (h *Houses) TableName() string {
	return "houses"
}
